<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        ul{
            
            list-style: none;
           
            margin-top: 50px;
            margin-left: 200px;
            display: block;
        }
        ul li{
            width: 250px;
            height: 200px;
            float: left;
        }
        ul li img{
            width: 100%;
            height: 100%;
            cursor: pointer;
        }
       
    </style>
</head>
<body>
     <ul>
        <li>
            <img src="https://img0.baidu.com/it/u=902790840,3669546928&fm=253&fmt=auto&app=120&f=JPEG?w=1422&h=800" alt="">
        </li>
        <li>
            <img src="https://img0.baidu.com/it/u=3713804908,3979301420&fm=253&fmt=auto&app=120&f=JPEG?w=1422&h=800" alt="">
        </li>
        <li>
            <img src="https://img0.baidu.com/it/u=2923406337,3064763995&fm=253&fmt=auto&app=120&f=JPEG?w=1280&h=800" alt="">
        </li>
        <li>
            <img src="https://img1.baidu.com/it/u=3475316330,1337807004&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500" alt="">
        </li>
     </ul>
    <script>
       let img=   document.querySelectorAll("img")
       let bodyEl=  document.body 
       for(let i=0; i<img.length; i++){
        img[i].onclick=function(){
           console.log(this.src);
           bodyEl.style.backgroundImage=`url(${this.src})`
         
        }
       }
    </script>
</body>
</html>